// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV,
  traceUser: true
}) // 使用当前云环境

const getHistory = require('./getHistory/index');
const addOrder = require('./addOrder/index');
const getOrderInfo = require('./getOrderInfo/index');
const getOrderDetail = require('./getOrderDetail/index');
const editOrderProcess = require('./editOrderProcess/index');
const getOrderList = require('./getOrderList/index');
const addMoneyType = require('./addMoneyType/index');
const getMoneyType = require('./getMoneyType/index');
const login = require('./login/index');
const updateUserInfo = require('./updateUserInfo/index');
const getUserInfo = require('./getUserInfo/index');


// 云函数入口函数
exports.main = async (event, context) => {
  switch (event.cloud_function) {
    case 'getHistory':
      return await getHistory.main(event, context);
    case 'addOrder':
      return await addOrder.main(event, context);
    case 'getOrderInfo':
      return await getOrderInfo.main(event, context);
    case 'getOrderDetail':
      return await getOrderDetail.main(event, context);
    case 'editOrderProcess':
      return await editOrderProcess.main(event, context);
    case 'getOrderList':
      return await getOrderList.main(event, context);
    case 'addMoneyType':
      return await addMoneyType.main(event, context);
    case 'getMoneyType':
      return await getMoneyType.main(event, context);
    case 'login':
      return await login.main(event, context);
    case 'updateUserInfo':
      return await updateUserInfo.main(event, context);
    case 'getUserInfo':
      return await getUserInfo.main(event, context);

  }
}